package com.jvm123.blog.servlet

import javax.servlet.ServletRequestEvent
import javax.servlet.ServletRequestListener
import javax.servlet.annotation.WebListener
import javax.servlet.http.HttpServletRequest

/**
 *
 * @author yawn http://jvm123.com
 *     2019/11/4 11:42
 */
@WebListener
class RequestListener implements ServletRequestListener {

    @Override
    void requestDestroyed(ServletRequestEvent event) {
        HttpServletRequest request = (HttpServletRequest) event.getServletRequest()
        println "request被销毁：" + request.getRequestURL()
    }

    @Override
    void requestInitialized(ServletRequestEvent event) {
        HttpServletRequest request = (HttpServletRequest) event.getServletRequest()
        println "request初始化：" + request.getRequestURL()
    }
}
